package com.example.demo.design.GoF.strategy.example;

/**
 * 策略模式
 *
 * @author luowj12
 * @since 2021/5/6 13:54
 */
public class StrategyPattern {

    public static void main(String[] args) {
        Context c = new Context();
        Strategy s = new ConcreteStrategyA();
        c.setStrategy(s);
        c.strategyMethod();
        System.out.println("-----------------");
        s = new ConcreteStrategyB();
        c.setStrategy(s);
        c.strategyMethod();
    }

}
